#!/usr/bin/env node

//setTimeout延时执行
class Bomb{
    constructor(){
        this.timer = null;
    }
    start(){
        this.timer = setTimeout(()=>{
            console.log("Boom!")
        },3000);
    }
    clear(){
        if(this.timer){
            clearTimeout(this.timer);
            this.timer = null;
        }
    }
}

const b1 = new Bomb();
b1.start();

const b2 = new Bomb();
b2.start();
setTimeout(()=>{
    b2.clear();
},1000)


